<!DOCTYPE html>
<html>
	<head>
		<title>
			新引擎测试页面
		</title>
		<meta charset = "utf-8">
		<script type="text/javascript">
		   //获取已安装模块列表
			function getInstalledModuleList() {
				navigator.moduleoperation.getInstalledModuleList(function(list) {
					alert(list);
				},function(err) {
					alert(err);
				});
			}
			//获取未安装模块列表
			function getUnInstalledModuleList() {
				navigator.moduleoperation.getUninstallModuleList(function(list) {
					alert(list);
				},function(err) {
					alert(err);
				});
			}
			
			//获取待更新模块列表
			function getUpgradeableModuleList() {
				navigator.moduleoperation.getUpgradeableModuleList(function(list) {
					alert(list);
				},function(err) {
					alert(err);
				});
			}
			
			//安装模块
			function installModule(identify) {
				navigator.moduleoperation.installModule(function() {
					//接口没定义成功方法
				},function(err) {
					
				},'com.foreveross.h5.demo');
			}
			
			function deleteModule(identify) {
				navigator.moduleoperation.deleteModule(function() {
					//接口没定义成功方法
				},function(err){
				
				},'com.foreveross.h5.demo');
			} 
			
			//升级模块
			function upgradeModule(identify) {
				navigator.moduleoperation.upgradeModule(function() {
					//接口没定义成功方法
				},function(err) {
					
				},identify);
			}
			
			function getAllModuleList() {
				navigator.moduleoperation.getAllModuleList(function(list) {
					alert(list);
				},function(err) {
					alert();
				});
			}
			
			function test() {
				navigator.moduleoperation.test(function() {
					
				},function(err) {
					
				},"com.test.module");
			}
			
			function moduleDownloadStart(identify) {
				alert('moduleDownloadStart====>' + identify );
			}
			
			function updateModuleProgress(identify,progress) {
				alert('updateModuleProgress====>' + identify + 'progress===>' + progress );
			}
			
			function moduleInstallState(identify,state) {
				if(state == 'true') {
					alert("模块:" + identify + "安装成功!");
				} else {
					alert("模块:" + identify + "安装失败!");
				}
			}
			
			function moduleUninstallState(identify,state) {
				if(state == 'true') {
					alert("模块:" + identify + "删除成功!");
				} else {
					alert("模块:" + identify + "删除失败!");
				}
			}
			function moduleUpgradeState(identify,state) {
				if(state == 'true') {
					alert("模块:" + identify + "升级成功!");
				} else {
					alert("模块:" + identify + "升级失败!");
				}
			}
		</script>
	</head>
	<body>
		<h1>navigator方式接口测试</h1>
		<button id= 'getInstalledModuleList' onclick="getInstalledModuleList();">获取安装模块列表</button><br>
		<button id= 'getUnInstalledModuleList' onclick="getUnInstalledModuleList();">获取未模块列表</button><br>
		<button id= 'getUpgradeModuleList' onclick="getUpgradeableModuleList();">获取更新模块列表</button><br>
		<button id= 'getAllModuleList' onclick="getAllModuleList();">获取所有模块</button><br>
		<button id= 'installModule' onclick="installModule();">安装模块</button><br>
		<button id= 'upgradeModule'>升级模块</button><br>
		<button id= 'deleteModule' onclick="deleteModule();">删除模块</button><br>
		<button id= 'checkAppUpdate'>检测App</button><br>
		<button id= 'test' onclick="test();">测试</button><br>
	</body>
	<script type="text/javascript" src="./cordova.js"></script> 
</html>